package com.kk.demo.java8;

import java.util.ArrayList;
import java.util.List;
import java.util.function.Function;

public class FunctionUse {

    List<Function<Integer, Integer>> list = new ArrayList<>();

    public FunctionUse a(Function<Integer, Integer> i) {
        list.add(i);
        return this;
    }

    public void run(int ss) {
        list.stream().sorted().forEach(a -> {
           int out =  a.apply(ss);
            System.out.println(out);
            });
    }

    public static void main(String[] args) {
        new FunctionUse().a(a -> {
            return a + a;
        }).run(5);
    }

}
